/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
// monaco-editor/esm/vs/basic-languages/python/python.js
import { languages } from 'monaco-editor/esm/vs/basic-languages/fillers/monaco-editor-core.js';
export var conf = {
    comments: {
        lineComment: '#',
        blockComment: ["'''", "'''"]
    },
    brackets: [
        ['{', '}'],
        ['[', ']'],
        ['(', ')']
    ],
    autoClosingPairs: [
        { open: '{', close: '}' },
        { open: '[', close: ']' },
        { open: '(', close: ')' },
        { open: '"', close: '"', notIn: ['string'] },
        { open: "'", close: "'", notIn: ['string', 'comment'] }
    ],
    surroundingPairs: [
        { open: '{', close: '}' },
        { open: '[', close: ']' },
        { open: '(', close: ')' },
        { open: '"', close: '"' },
        { open: "'", close: "'" }
    ],
    onEnterRules: [
        {
            beforeText: new RegExp('^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$'),
            action: { indentAction: languages.IndentAction.Indent }
        }
    ],
    folding: {
        offSide: true,
        markers: {
            start: new RegExp('^\\s*#region\\b'),
            end: new RegExp('^\\s*#endregion\\b')
        }
    }
};
export var language = {
    defaultToken: '',
    tokenPostfix: '.python',
    keywords: [
        "exec",
        "frexp",
        "gamma",
        "tan",
        "def",
        "or",
        "pow",
        "options",
        "print",
        "split",
        "timedelta",
        "xrange",
        "session",
        "thread_time",
        "ConnectTimeout",
        "spawnv",
        "perm",
        "__bases__",
        "OpenWrapper",
        "times_result",
        "setattr",
        "BufferedIOBase",
        "request",
        "class",
        "fabs",
        "oct",
        "callable",
        "get",
        "capwords",
        "get_clock_info",
        "memoryview",
        "PreparedRequest",
        "as",
        "_AddedDllDirectory",
        "_subx",
        "replace",
        "__import__",
        "terminal_size",
        "modf",
        "execvp",
        "tzinfo",
        "for",
        "__subclasses__",
        "remove",
        "continue",
        "bool",
        "trunc",
        "BufferedReader",
        "IOBase",
        "BufferedRWPair",
        "startfile",
        "and",
        "import",
        "execv",
        "atanh",
        "ldexp",
        "ord",
        "log1p",
        "range",
        "get_exec_path",
        "complex",
        "RawIOBase",
        "template",
        "enumerate",
        "atan",
        "staticmethod",
        "break",
        "help",
        "_exists",
        "Response",
        "_Environ",
        "fstat",
        "format",
        "close",
        "umask",
        "__init__",
        "all",
        "IncrementalNewlineDecoder",
        "thread_time_ns",
        "subn",
        "purge",
        "await",
        "self",
        "sorted",
        "_fspath",
        "__mro__",
        "property",
        "UnsupportedOperation",
        "filter",
        "system",
        "if",
        "exp",
        "getenv",
        "set",
        "open_code",
        "RequestsDependencyWarning",
        "acosh",
        "asinh",
        "asin",
        "elif",
        "ulp",
        "process_time_ns",
        "scandir",
        "stat_result",
        "abort",
        "RegexFlag",
        "getattr",
        "cosh",
        "from",
        "strptime",
        "post",
        "search",
        "log",
        "tanh",
        "stat",
        "sqrt",
        "log2",
        "_check_methods",
        "isclose",
        "unichr",
        "hasattr",
        "isinf",
        "nonlocal",
        "DependencyWarning",
        "slice",
        "escape",
        "monotonic",
        "time",
        "write",
        "isinstance",
        "sinh",
        "acos",
        "PathLike",
        "zip",
        "ConnectionError",
        "getppid",
        "readlink",
        "nextafter",
        "strftime",
        "id",
        "perf_counter",
        "comb",
        "Request",
        "getcwdb",
        "apply",
        "min",
        "TooManyRedirects",
        "__members__",
        "Match",
        "long",
        "frozenset",
        "putenv",
        "iter",
        "isnan",
        "compile",
        "renames",
        "object",
        "execlp",
        "intern",
        "next",
        "chdir",
        "eval",
        "lambda",
        "remainder",
        "DirEntry",
        "closerange",
        "MutableMapping",
        "locals",
        "_expand",
        "basestring",
        "False",
        "dup",
        "__dict__",
        "execlpe",
        "check_compatibility",
        "fsencode",
        "get_handle_inheritable",
        "in",
        "type",
        "super",
        "date",
        "execve",
        "sub",
        "lstat",
        "perf_counter_ns",
        "datetime",
        "access",
        "vars",
        "expm1",
        "sum",
        "popen",
        "isatty",
        "True",
        "tuple",
        "unicode",
        "reload",
        "execvpe",
        "divmod",
        "chmod",
        "kill",
        "Formatter",
        "hex",
        "prod",
        "coerce",
        "symlink",
        "utime",
        "getcwd",
        "get_terminal_size",
        "set_inheritable",
        "assert",
        "monotonic_ns",
        "lseek",
        "log10",
        "__methods__",
        "spawnl",
        "listdir",
        "struct_time",
        "_compile",
        "process_time",
        "list",
        "try",
        "hypot",
        "__name__",
        "add_dll_directory",
        "delete",
        "link",
        "global",
        "makedirs",
        "BytesIO",
        "while",
        "fdopen",
        "rename",
        "round",
        "isqrt",
        "ceil",
        "execl",
        "open",
        "BufferedRandom",
        "ctime",
        "JSONDecodeError",
        "waitpid",
        "Mapping",
        "int",
        "_compile_repl",
        "spawnve",
        "unsetenv",
        "_WindowsConsoleIO",
        "classmethod",
        "not",
        "len",
        "repr",
        "fullmatch",
        "pass",
        "max",
        "ftruncate",
        "bytearray",
        "map",
        "file",
        "erf",
        "strerror",
        "return",
        "Session",
        "_ChainMap",
        "floor",
        "NullHandler",
        "FileModeWarning",
        "match",
        "any",
        "dict",
        "RequestException",
        "is",
        "sin",
        "copysign",
        "_wrap_close",
        "BlockingIOError",
        "delattr",
        "float",
        "erfc",
        "gmtime",
        "input",
        "set_handle_inheritable",
        "bin",
        "uname_result",
        "degrees",
        "get_inheritable",
        "reversed",
        "pipe",
        "error",
        "atan2",
        "isfinite",
        "mkdir",
        "spawnle",
        "_get_exports_list",
        "_walk",
        "execle",
        "urandom",
        "_exit",
        "fsum",
        "ReadTimeout",
        "raise",
        "TextIOBase",
        "str",
        "head",
        "None",
        "device_encoding",
        "Template",
        "finditer",
        "unlink",
        "read",
        "Pattern",
        "cpu_count",
        "Timeout",
        "_check_cryptography",
        "getpid",
        "lgamma",
        "put",
        "execfile",
        "findall",
        "localtime",
        "else",
        "walk",
        "fsync",
        "patch",
        "with",
        "TextIOWrapper",
        "_pickle",
        "globals",
        "buffer",
        "cos",
        "__class__",
        "removedirs",
        "fsdecode",
        "truncate",
        "mktime",
        "abs",
        "time_ns",
        "sleep",
        "URLRequired",
        "finally",
        "times",
        "hash",
        "FileIO",
        "BufferedWriter",
        "dir",
        "reduce",
        "yield",
        "gcd",
        "rmdir",
        "statvfs_result",
        "timezone",
        "dup2",
        "_execvpe",
        "GenericAlias",
        "radians",
        "del",
        "Scanner",
        "except",
        "fmod",
        "cmp",
        "waitstatus_to_exitcode",
        "asctime",
        "StringIO",
        "getlogin",
        "async",
        "dist",
        "HTTPError",
        "issubclass",
        "chr",
        "fspath",
        "raw_input",
        "lcm",
        "factorial"
    ],
    brackets: [
        { open: '{', close: '}', token: 'delimiter.curly' },
        { open: '[', close: ']', token: 'delimiter.bracket' },
        { open: '(', close: ')', token: 'delimiter.parenthesis' }
    ],
    tokenizer: {
        root: [
            { include: '@whitespace' },
            { include: '@numbers' },
            { include: '@strings' },
            [/[,:;]/, 'delimiter'],
            [/[{}\[\]()]/, '@brackets'],
            [/@[a-zA-Z_]\w*/, 'tag'],
            [
                /[a-zA-Z_]\w*/,
                {
                    cases: {
                        '@keywords': 'keyword',
                        '@default': 'identifier'
                    }
                }
            ]
        ],
        // Deal with white space, including single and multi-line comments
        whitespace: [
            [/\s+/, 'white'],
            [/(^#.*$)/, 'comment'],
            [/'''/, 'string', '@endDocString'],
            [/"""/, 'string', '@endDblDocString']
        ],
        endDocString: [
            [/[^']+/, 'string'],
            [/\\'/, 'string'],
            [/'''/, 'string', '@popall'],
            [/'/, 'string']
        ],
        endDblDocString: [
            [/[^"]+/, 'string'],
            [/\\"/, 'string'],
            [/"""/, 'string', '@popall'],
            [/"/, 'string']
        ],
        // Recognize hex, negatives, decimals, imaginaries, longs, and scientific notation
        numbers: [
            [/-?0x([abcdef]|[ABCDEF]|\d)+[lL]?/, 'number.hex'],
            [/-?(\d*\.)?\d+([eE][+\-]?\d+)?[jJ]?[lL]?/, 'number']
        ],
        // Recognize strings, including those broken across lines with \ (but not without)
        strings: [
            [/'$/, 'string.escape', '@popall'],
            [/'/, 'string.escape', '@stringBody'],
            [/"$/, 'string.escape', '@popall'],
            [/"/, 'string.escape', '@dblStringBody']
        ],
        stringBody: [
            [/[^\\']+$/, 'string', '@popall'],
            [/[^\\']+/, 'string'],
            [/\\./, 'string'],
            [/'/, 'string.escape', '@popall'],
            [/\\$/, 'string']
        ],
        dblStringBody: [
            [/[^\\"]+$/, 'string', '@popall'],
            [/[^\\"]+/, 'string'],
            [/\\./, 'string'],
            [/"/, 'string.escape', '@popall'],
            [/\\$/, 'string']
        ]
    }
};
